<?

$title="Forgot password";

require("required/dbconnect.php");
require("required/share_function.php");
require("required/header.php");
require("required/email.php");

if(!empty($_SESSION['loginid']))

{

?>

<script language="javascript">

window.location='index.php';

</script>

<?

}

$msg="";

if(isset($_POST['btnsubmit']))

{

	$username=$_POST['username'];

	$email=$_POST['email'];

	

	$match=mysql_query("select * from os_member where email='$email'");

	

	if(mysql_num_rows($match)>0)

	{

		$password=mysql_result($match,0,'password');	
		email_forgot_password($email,$password);

	}

	else

	{

		$msg="<div class='dw_failed'>Email is not found, please check.</div>";

	}

}

?>



	<table width="100%" align="center" cellpadding="4" cellspacing="0" >

		<tr>

			<td class="page_title_bar" height="30" valign="middle">

				Forgot Password

			</td>

		</tr>		

		<tr>

			<td align="left" valign="top" height="300">

				<table width="100%" >

				<form name="form1" id="form1" method="post" action="<?= $_SERVER['PHP_SELF']; ?>">

					

					<tr>

						<td valign="top" colspan="2" align="center">

							<?= $msg  ?> 	

						</td>

					</tr>

					<tr>

						<td valign="top" colspan="2"><b>Please enter your email.</b></td>

					</tr>

					<tr>

						<td>Email</td><td><input type="text" size="30" class="contentfont" name="email"></td>

					</tr>

					<tr>

						<td colspan="2"><input type="submit" name="btnsubmit" class="button" value="Send"><br>

						

						</td>

					</tr>

				</form>

				</table>

			</td>

		</tr>

	</table>	



<?  require("required/footer.php"); ?>